package inteface.utils;

import java.io.File;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.filechooser.FileView;


/* ImageFileView.java is a 1.4 example used by FileChooserDemo2.java. */
public class TERFileSaveView extends FileView {
    ImageIcon saveIcon = Utils.createImageIcon("images/saveIcon.gif");

    public String getName(File f) {
        return null; //let the L&F FileView figure this out
    }

    public String getDescription(File f) {
        return null; //let the L&F FileView figure this out
    }

    public Boolean isTraversable(File f) {
        return null; //let the L&F FileView figure this out
    }

    public String getTypeDescription(File f) {
        String extension = Utils.getExtension(f);
        String type = null;

        if (extension != null) {
            if (extension.equalsIgnoreCase(Utils.sav)) {
                type = "Fichier de sauvegarde (*.sav)";
            }
        }
        return type;
    }

    public Icon getIcon(File f) {
        String extension = Utils.getExtension(f);
        Icon icon = null;

        if (extension != null) {
            if (extension.equals(Utils.sav)) {
                icon = saveIcon;
            }
        }
        return icon;
    }
}
